// 开发环境配置
import packageInfo from '@/package.json';

const { version } = packageInfo;
export let baseUrl;
if (process.env.NODE_ENV === 'development') {
  baseUrl = import.meta.env.SHOPRO_DEV_BASE_URL;
} else {
  baseUrl = import.meta.env.SHOPRO_BASE_URL;
}

if (typeof baseUrl === 'undefined') {
  console.error('请检查.env配置文件是否存在');
} else {
  console.log(`[Shopro ${version}]`);
}

export const apiPath = import.meta.env.SHOPRO_API_PATH;

export const staticUrl = import.meta.env.SHOPRO_STATIC_URL;

// 图片地址
export const nc_url = import.meta.env.SHOPRO_NC_IMAGE_URL;

// 图片地址前缀
export const nc_prefix = import.meta.env.SHOPRO_NC_IMAGE_PATH;

// 拾亲使用的图片路径地址前缀
export const sq_prefix = import.meta.env.SHOPRO_SQ_IMAGE_URL;

// AI地址
export const ai_url = import.meta.env.SHOPRO_SUBDOMAIN;

export const mp_code = import.meta.env.SHOPRO_MP_VERSION

export const ios_code = import.meta.env.SHOPRO_IOS_VERSION

export const android_code = import.meta.env.SHOPRO_ANDROID_VERSION

export const h5_code = import.meta.env.SHOPRO_H5_VERSION

export const wss_url = import.meta.env.SHOPRO_WSS_URL

export const h5_url = import.meta.env.SHOPRO_H5_URL

if (process.env.NODE_ENV === 'development') {
  console.log('请求地址路径=>',baseUrl, 'apiPath=>', apiPath, 'staticUrl=>', staticUrl);
}

export default {
  baseUrl,
  apiPath,
  staticUrl,
  nc_url,
  nc_prefix,
  sq_prefix,
  ai_url,
  wss_url,
  h5_url
};
